
setTimeout(function(){
	//$("#dictionary_editName").focus();
	$("#dictionary_editName").rules("add",{
		remote: {
			url : 'sys/dic/checkEditName?name='+$("#dictionary_editName").val()+"&id="+getQueryString("id"),
			type: "get",
			dataType: "json", 
			dataFilter:function(data,type){
				return data=="false"?false:true;
			}
		}, 
		messages: {remote: "该字典名称已存在"}
		
	}); 
} , parseInt(Math.random() * 1000)); 


setTimeout(function(){
	//$("#dictionary_editCode").focus();
	$("#dictionary_editCode").rules("add",{
		remote: {
			url : 'sys/dic/checkEditCode?code='+$("#dictionary_editCode").val()+"&id="+getQueryString("id"),
			type: "get",
			dataType: "json", 
			dataFilter:function(data,type){
				return data=="false"?false:true;
			}
		}, 
		messages: {remote: "该字典编码已存在"}
		
	}); 
} , parseInt(Math.random() * 1000)); 





var app = angular.module('dictionaryApp', []);

app.controller('dictionaryController', function($scope, $http) {
	$scope.pwd;
	$scope.view=function(){
		$http.get(timestamp("sys/dic/get/"+getQueryString("id"))).success(function (response) {
			$scope.dictionary = response.data;
		});
	}
	
	$scope.view();
	$scope.refreshData=function(){
		$scope.view();
	}
	
	$scope.dictionarySave=function(){
	   if($("#myForm").valid()){
		   $http.put('sys/dic/update/', $scope.dictionary).success(function(){
               redirectUrl("manage/dictionary/","list.jsp");
           });
	   }
	}
	
	$scope.dictionaryReset=function(){
		$scope.view();
	}
	
	$scope.dictionaryCancle=function(){
		redirectUrl("manage/dictionary/","list.jsp");
	}
});